<?php
namespace app\login\validate;
use think\Validate;
class Account extends Validate {
    //验证字段
    protected $rule = [
        'account_name' => ['require'],
        'password' => ['require'],
//        'openId' => ['require'],
        'islock' => ['require','number'],
//        'id' => ['require','number'],
    ];
    //返回消息
    protected $message = [
        'account_name.require' => '登录名必须',
        'password.require' => '密码必须',
        'personId.require' => '工号必须',
        'islock.require' => '是否锁定必须',
        'islock.number' => '是否锁定不是数字',
/*        'id.require' => '必须',
        'id.number' => '不是数字',*/
    ];

    // add 场景
    public function sceneAdd(){
        return $this->only(['account_name','password']);
    }
    // add_by_mini 场景
    public function sceneAdd_by_mini(){
        return $this->only(['personId']);
    }

    // only_id 场景
    public function sceneOnly_id(){
        return $this->only(['id']);
    }

    // all_field 场景
    public function sceneAll_field(){
        return $this->only(['id','account_name','password','openid','islock']);
    }
}
